/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2024-04-14 21:08:58
 * @LastEditTime: 2024-07-07 17:24:46
 * @FilePath: /nest_study/web/src/views/operation/login_log/columns.tsx
 */
import ShowDictionary from "@/components/dictionary_label";
import { formateLocalDateTime } from "@/utils";
import { statusList } from "./dictionary";
import { Flex } from "antd";

export const columns = () => [
    {
        title: '编号',
        dataIndex: 'id',
        width:80,
        ellipsis: true
    },
    {
        title: '登录名称',
        dataIndex: 'userName',
        ellipsis: true
    },
    {
        title: 'IP地址',
        dataIndex: 'ip',
        ellipsis: true
    },
    {
        title: '登录地点',
        dataIndex: 'location',
        ellipsis: true
    },
    {
        title: '操作系统',
        dataIndex: 'os',
        ellipsis: true
    },
    {
        title: '浏览器',
        dataIndex: 'browser',
        ellipsis: true
    },
    {
        title: '登录状态',
        dataIndex: 'status',
        ellipsis: true,
        width:100,
        align: "center" as "center",
        render: (text: any, _row: any, _index: number) => <Flex justify="center"><ShowDictionary list={statusList} label={'label'} value={text} /></Flex>,
    },
    {
        title: '备注',
        dataIndex: 'msg',
        ellipsis: true
    },
    {
        title: '操作时间',
        dataIndex: 'loginTime',
        width: 165,
        render: (text: any, _row: any, _index: number) => <p>{formateLocalDateTime(text)}</p>,
    }
]